@echo off

path C:\Program Files\ImageMagick-6.6.7-Q16;%path%

echo Fill drawable-hdpi-v9: 24w x 38h px...
set dest=drawable-hdpi-v9
set resize=x24+0+7
set extend=x38
call :process

echo Fill drawable-mdpi-v9: 16w x 25h px...
set dest=drawable-mdpi-v9
set resize=x16+0+4
set extend=x25
call :process

echo Fill drawable-ldpi-v9: 12w x 19h px...
set dest=drawable-ldpi-v9
set resize=x12+0+3
set extend=x19
call :process

set froyo=true

echo Fill drawable-hdpi: 38x38 pixel artboard size with a 2 pixel safeframe...
set dest=drawable-hdpi
set resize=x36
set extend=38x38
call :process

echo Fill drawable-mdpi: 25x25 pixel artboard size with a 2 pixel safeframe...
set dest=drawable
set resize=x23
set extend=25x25
call :process

echo Fill drawable-ldpi: 19x19 pixel artboard size with a 2 pixel safeframe...
set dest=drawable-ldpi
set resize=x17
set extend=19x19
call :process

echo Create launcher icons...

convert ic_launcher_nagroid.png -resize x60+0+6 -gravity center -background none -extent 72x72 temp.png
pngcrush -q -nofilecheck temp.png ..\res\drawable-hdpi\ic_launcher_nagroid.png

convert ic_launcher_nagroid.png -resize x40+0+4 -gravity center -background none -extent 48x48 temp.png
pngcrush -q -nofilecheck temp.png ..\res\drawable\ic_launcher_nagroid.png

convert ic_launcher_nagroid.png -resize x30+0+3 -gravity center -background none -extent 36x36 temp.png
pngcrush -q -nofilecheck temp.png ..\res\drawable-ldpi\ic_launcher_nagroid.png

del temp.png

echo Done.
echo.
pause
exit

:process

for %%s in (ok warning unknown error) do (
	if not exist ..\res\%dest% mkdir ..\res\%dest%
	if defined froyo (
		if %%s==ok (
			convert ic_stat_notify_froyo_%%s.png -resize %resize% -gravity center -background none -extent %extend% temp.png
		) else (
			convert ic_stat_notify_%%s.png -resize %resize% -gravity center -background none -extent %extend% temp.png
		)
	) else (
		convert ic_stat_notify_%%s.png -resize %resize% -gravity center -background none -extent %extend% temp.png
	)
	pngcrush -q -nofilecheck temp.png ..\res\%dest%\ic_stat_notify_%%s.png
)

goto :EOF
pause